package com.lastoffer2.listener;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;

public class MapImageOnClickListener implements OnClickListener {
	
	private Context context;
	private double latitude;
	private double longitude;
	
	public MapImageOnClickListener(Context context,double latitude, double longitude) {
		this.latitude = latitude;
		this.longitude = longitude;
		this.context=context;
	}


	@Override
	public void onClick(View v) {
		
		String uri = "geo:"+ latitude + "," + longitude+"?q="+ latitude + "," + longitude;
		context.startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
//		String uriBegin = "geo:" + latitude + "," + longitude;
//		String query = latitude + "," + longitude + "(" + label + ")";
//		String encodedQuery = Uri.encode(query);
//		String uriString = uriBegin + "?q=" + encodedQuery + "&z=16";

//		String uriString="http://maps.google.com/maps?q="+latitude+"+"+longitude;
//		Log.i("MAP QUERY", "string. "+uriString);
//		Uri uri = Uri.parse(uriString);
//		Log.i("MAP QUERY", "uri "+uri);
//		Intent mapCall = new Intent(android.content.Intent.ACTION_VIEW, uri);
//		context.startActivity(mapCall);
	}

}
